import { name } from '../../../package.json'

const localStoragePrefix = name + '-'

export const localStorageMethods = {
  getLocalStorage(key: string) {
    const value = window.localStorage.getItem(localStoragePrefix + key)
    if (!value || value === '') return ''
    return value
  },
  removeLocalStorage(key: string) {
    window.localStorage.removeItem(localStoragePrefix + key)
  },
  setLocalStorage(key: string, value: string) {
    if (!value) window.localStorage.setItem(localStoragePrefix + key, '')
    else window.localStorage.setItem(localStoragePrefix + key, value)
  }
}
